/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package webservices;


import java.io.BufferedReader;
import java.io.FileReader;
import java.util.ArrayList;
import javax.jws.WebMethod;
import javax.jws.WebService;

/**
 *
 * @author Klu12
 */
@WebService()
public class LireBase {

    public static final int userDB_Name=0;
    public static final int userDB_Pass=1;
    public static final int commandDB_NameBid=0;
    public static final int commandDB_HighestBid=1;
    public static final int commandDB_UserBid=2;
    private final String userFileName = "/tmp/user_ebay_des_cochons.txt";
    private final String commandFileName = "/tmp/enchere_ebay_des_cochons.txt";

    /**
     * Web service operation
     */
    @WebMethod(operationName = "readTopUser")
    public String readTopUser() {
        String result="";
        try {
            BufferedReader f = new BufferedReader(new FileReader(userFileName));
            result=f.readLine();
        } catch (Exception ex) {
            result="";
        }
//        if(line.split("[;]").length==2)
//        {
//            result.add(line.split("[;]")[userDB_Name]);
//            result.add(line.split("[;]")[userDB_Pass]);
//        }
        return result;
    }
     // This comment is a test

    @WebMethod(operationName = "readTopCommand")
    public String readTopCommand() {
        String result="";
        try {
            BufferedReader f = new BufferedReader(new FileReader(commandFileName));
            result=f.readLine();
        } catch (Exception ex) {
            result="";
        }
//        if(line.split("[;]").length==3)
//        {
//            result.add(line.split("[;]")[commandDB_NameBid]);
//            result.add(line.split("[;]")[commandDB_HighestBid]);
//            result.add(line.split("[;]")[commandDB_UserBid]);
//        }
        return result;
    }

}
